package chixing.day11.work.w9;
public class Manager implements Approver {
    private String name;

    public Manager(String name) {
        this.name = name;
    }

    @Override
    public void approve(ApprovalRequest request) {
        System.out.println("申请人: " + request.getApplicant());
        System.out.println("申请时间: " + request.getRequestTime());
        System.out.println("申请说明: " + request.getDescription());

        if (request instanceof LeaveRequest) {
            LeaveRequest leaveRequest = (LeaveRequest) request;
            if (leaveRequest.getDays() <= 3) {
                System.out.println("主管 " + name + " 批准了请假申请");
            } else {
                System.out.println("请假天数超过3天，需上级审批");
            }
        } else if (request instanceof ExpenseRequest) {
            ExpenseRequest expenseRequest = (ExpenseRequest) request;
            if (expenseRequest.getAmount() <= 1000) {
                System.out.println("主管 " + name + " 批准了费用报销申请");
            } else {
                System.out.println("报销金额超过1000元，需财务审批");
            }
        }
        System.out.println("------------------------");
    }
}


